home *** CD-ROM | disk | FTP | other *** search
/ PC User 2002 April / Disc 2 / PCUSER0402D2.iso / software / utils / files / wincron.exe / data1.cab / Sample_Scripts / ftp_rename.tg < prev    next >
Encoding:
Text File  |  2001-10-20  |  1.4 KB  |  46 lines

  1. ## ftp_rename.tab
  2. # Put a file on the remore server
  3. # script assumes:
  4. # 1. There is a temp/foo/test_file.dat file on the remote server.
  5. # 2. the environment variables: USER.SERVER, USER.USERID, and USER.PASSWORD are set elsewhere,
  6. #    perhaps in the global (computer) environment or the local environment of WinCron via 
  7. #    Config.tg or AutoRun.tg. You could also set them here in this this script or hard-code the 
  8. #    values passed to -ftp connect.
  9.  
  10. # rename a remote file
  11. {
  12.     -name ftp_rename
  13.     -start 
  14.     -stop
  15.     -action -print TEST * Rename file on remote ftp server
  16.     -action -print connecting to remote ftp server
  17.     -action -onerror connect_fail
  18.     -action -ftp connect handle %USER.SERVER% 21 %USER.USERID% %USER.PASSWORD%
  19.     -action -print attempt to rename file on remote ftp server
  20.     -action -onerror general_failure
  21.     -action -ftp cd handle temp/foo
  22.     -action -ftp rename handle test_file.dat test_file.foo
  23.     -action -ftp rename handle test_file.foo test_file.dat
  24.     -action -ftp close handle 
  25.     -action -print done!
  26. }
  27.  
  28. # connection failed
  29. {
  30.     -name connect_fail
  31.     -action -print FTP open connection failed with error:
  32.     -action -print %TG.LAST_ERROR%
  33.     -action -return abort
  34. }
  35.  
  36. # general failure
  37. {
  38.     -name general_failure
  39.     -action -print FTP general failure with error:
  40.     -action -print %TG.LAST_ERROR%
  41.     -action -print Closing connection.
  42.     -action -ftp close handle
  43.     -action -return abort
  44. }
  45.  
  46.